<div class="cms-content-pane">
    <div class="category-pane">
        <div class="pane-header">
            Link Categories
            <div style="width: 50px; position: absolute; right: 10px; top: 2px; text-align:right; ">
                <a id="add-cat-link" href="#" title="Add Category" ><img src="images/icons/add.png" width="16" height="16" alt="add" align="absmiddle" border="0" /></a> 
                <a id="del-cat-link" href="<?php echo $this->url(array('action' => 'delete_category')); ?>" title="Delete Selected Category"><img src="images/icons/delete.png" width="16" height="16" alt="add" align="absmiddle" border="0" /></a>
            </div>
        </div>
        <div class="pane-content">
            <ul class="category-list">
                <?php
                $links = new LinksManager();
                $categories = $links->getLinkCategories();

                for($i = 0; $i < count($categories); $i++) {
                    $cat_id = $categories[$i]->getCategoryId();
                    $cat = $categories[$i]->getCategoryName();
                    $desc = $categories[$i]->getCategoryDescription();
                    
                    echo "<li><a id='$cat_id' href='#' title='$desc' >$cat</a></li>";
                }
                ?>
            </ul>
        </div>
    </div>
    <div class="articles-pane">
        <div class="pane-header">
            Links In
        </div>
        <div class="pane-sub-header">
            <a id='add-link' href="<?php echo $this->url(array('action' => 'add')); ?>"><img src="images/icons/newspaper_add.png" alt="add" width="16" height="16" border="0" align="absmiddle" /> New Quick Link</a> 
            <a id="move-link" href="<?php echo $this->url(array('action' => 'move_links')); ?>" ><img src="images/icons/newspaper_go.png" alt="del" width="16" height="16" border="0" align="absmiddle" /> Move Selected</a> 
            <a id="delete-link" href="<?php echo $this->url(array('action' => 'delete')); ?>" ><img src="images/icons/newspaper_delete.png" alt="del" width="16" height="16" border="0" align="absmiddle" /> Delete Selected</a>
        </div>
        <div id="news-content" class="pane-content">
            Loading Page. Please Wait...
        </div>
        <div class="pane-footer">
            Pages:
        </div>
    </div>
    <div id="catAddDiv" style="display: none; overflow: hidden; position:absolute; z-index: 30px; width: 334px; left: 140px; top: 20px; background:#ececec; height: 122px; border: solid #aaa 1px; background-color: #FFFFFF;">
        <div style="padding:10px;">
            <form id="catForm" name="catForm" method="POST" action="<?php echo $this->url(array('action' => 'add_category')); ?>" style="margin:0px;">
                <table width="98%" border="0" align="right" cellpadding="3" cellspacing="0">
                    <tr>
                        <td nowrap="nowrap"><strong>Category Name</strong></td>
                        <td>
                            <input name="CategoryName" type="text" id="CategoryName" size="25" />
                        </td>
                    </tr>
                    <tr>
                        <td nowrap="nowrap"><strong>Description:</strong></td>
                        <td>
                            <input name="CategoryDesc" type="text" id="CategoryDesc" size="25" />
                        </td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td>
                            <input name="add-cat-btn" type="button" class="small" id="add-cat-btn" value="Add Category" />
                            <input name="cancel-btn" type="button" class="small" id="cancel-btn" value="Cancel" />
                        </td>
                    </tr>
                </table>
                <input type="hidden" name="MM_insert2" value="catForm" />
                <input type="hidden" name="MM_insert" value="catForm" />
            </form>
        </div>
    </div>
</div>

<input type="hidden" id="ajax_url" value="<?php echo $this->url('ajax.php'); ?>" />
<input type="hidden" id="links_list_url" value="<?php echo $this->url(array('action' => 'list_links')); ?>" />

<?php echo $this->script('js/quick_links.js'); ?>
<script type="text/javascript">
function showCategoryEditWindow(id, catName, catDesc) {
	document.getElementById("EditCategoryName").value = catName;
	document.getElementById("EditCatDesc").value = catDesc;
	document.getElementById("EditCatID").value = id;

	$p("#catEditDiv").show();
}

$(document).ready( function() {
	quick_links.init();
});
</script>